import Axios from 'axios'
import {get,post} from './http'

//==========用户相关==========
//判断是否登陆成功
export const loginIn = params => post(`consumer/login`,params)
//注册用户
export const signUp = params => post(`consumer/add`,params)
//修改用户
export const updateConsumer = params => post(`consumer/update`,params)
//删除用户
export const delConsumer = id => get(`consumer/delete?id=${id}`)
//获取用户信息
export const getConsumerOfId = id => get(`consumer/getById?id=${id}`)
//获取用户信息
export const getConsumerOfId2 = id => get(`consumer/getById2?id=${id}`)
//获取所有用户信息
export const getAllConsumer = () => get(`consumer/allConsumer`)
//添加收藏或历史记录或点赞数
export const addNumber = params => post(`consumer/addNumber`,params)
//获取收藏记录
export const getCollectionById = id => get(`consumer/getCollectionById?id=${id}`)
//获取历史记录
export const getHistoryById = id => get(`consumer/getHistoryById?id=${id}`)
//获取点赞数
export const getPraiseById = id => get(`consumer/getPraiseById?id=${id}`)

//==========视频相关==========
//修改视频
export const updateVideo = params => post(`video/update`,params)
//删除视频
export const delVideo = id => get(`video/delete?id=${id}`)
//获取所有视频信息
export const getAllVideo = () => get(`video/allVideo`)
//根据id获取视频信息
export const getVideoById = (id) => get(`video/getById?id=${id}`)
//根据id增加视频播放数
export const playNumUp = (id) => get(`video/playNumUp?id=${id}`)
//根据style获取视频信息
export const getVideoByStyle = style => get(`video/getByStyle?style=${style}`)
//根据style获取排行榜视频信息
export const getVideoByStyle2 = style => get(`video/getByStyle2?style=${style}`)
//根据名字模糊查询视频信息
export const getVideoByVideoName = videoName => get(`video/getByVideoName?videoName=${videoName}`)
//所有热门视频信息
export const getAllHotVideo = () => get(`hotVideo/allHotVideo`)
//根据作者id获取视频信息
export const getByAuthorId = authorId => get(`video/getByAuthorId?authorId=${authorId}`)
//根据作者id获取视频信息
export const addBarrage = params => post(`video/addBarrage`,params)
//根据作者id获取视频信息
export const getBarrageById = id => get(`video/getBarrageById?id=${id}`)

//==========未审核视频相关==========
//添加未审核视频
export const setUnCheckVideo = params => post(`unCheckVideo/add`,params)
//修改未审核视频
export const updateUnCheckVideo = params => post(`unCheckVideo/update`,params)
//删除未审核视频
export const delUnCheckVideo = id => get(`unCheckVideo/delete?id=${id}`)
//根据作者id获取未审核视频信息
export const getUnCheckByAuthorId = authorId => get(`unCheckVideo/getByAuthorId?authorId=${authorId}`)

//==========评论相关==========
//提交评论
export const setComment = params => post(`/comment/add`,params)
//返回当前视频的评论列表
export const getCommentByVideoId = (videoId) =>get(`/comment/getCommentByVideoId?videoId=${videoId}`)
//评论点赞数+1
export const commnetPraiseUp = commentId => get(`/comment/praiseUp?commentId=${commentId}`)
//评论点赞数-1
export const commnetPraiseDown = commentId => get(`/comment/praiseDown?commentId=${commentId}`)
